package com.example.demo.pojo.request;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * 用于创建Quartz Cron Trigger的请求DTO。.
 *
 * @author Ethan Blake
 * @version 1.0
 * @since 2024/8/27
 */
@Schema(description = "用于创建Quartz Trigger的请求DTO。")
@Data
public class CronTriggerCreateRequest implements Serializable {

    private static final long serialVersionUID = -1314870674995032036L;

    /**
     * Quartz中Job的名称
     */
    @NotNull(message = "任务名称不能为空")
    @Size(min = 1, max = 100, message = "任务名称长度必须在1到100个字符之间")
    @Schema(description = "关联的任务名称", example = "myJob")
    private String jobName;

    /**
     * Quartz中Job所属的组
     */
    @NotNull(message = "任务组不能为空")
    @Size(min = 1, max = 100, message = "任务组长度必须在1到100个字符之间")
    @Schema(description = "关联的任务组", example = "defaultGroup")
    private String jobGroup;

    /**
     * Quartz中Trigger(触发器)的名称
     */
    @NotNull(message = "触发器名称不能为空")
    @Size(min = 1, max = 100, message = "触发器名称长度必须在1到100个字符之间")
    @Schema(description = "触发器的名称", example = "myTrigger")
    private String triggerName;

    /**
     * Quartz中Trigger(触发器)所属的组
     */
    @NotNull(message = "触发器组不能为空")
    @Size(min = 1, max = 100, message = "触发器组长度必须在1到100个字符之间")
    @Schema(description = "触发器的组", example = "defaultGroup")
    private String triggerGroup;

    /**
     * Cron表达式，用于定义Trigger(触发器)的调度时间
     */
    @NotNull(message = "Cron表达式不能为空")
    @Size(min = 1, max = 100, message = "Cron表达式长度必须在1到100个字符之间")
    @Schema(description = "定义调度的Cron表达式", example = "0/5 * * * * ?")
    private String cronExpression;

    /**
     * Trigger(触发器)的描述信息
     */
    @Schema(description = "触发器的描述", example = "这个触发器每5秒运行一次")
    private String description;
}
